package yiran.stock.manager;

import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

public class StockPriceUpdateEvent extends Event {
    private static final HandlerList handlers = new HandlerList();
    
    private final String symbol;
    private final double oldPrice;
    private final double newPrice;
    
    public StockPriceUpdateEvent(String symbol, double oldPrice, double newPrice) {
        this.symbol = symbol;
        this.oldPrice = oldPrice;
        this.newPrice = newPrice;
    }
    
    public String getSymbol() {
        return symbol;
    }

    public double getOldPrice() {
        return oldPrice;
    }

    public double getNewPrice() {
        return newPrice;
    }

    public double getChangePercent() {
        return ((newPrice - oldPrice) / oldPrice) * 100;
    }
    
    @Override
    public HandlerList getHandlers() {
        return handlers;
    }
    
    public static HandlerList getHandlerList() {
        return handlers;
    }
}
